VERSION 5.00
Object = "{33101C00-75C3-11CF-A8A0-444553540000}#1.0#0"; "cswsk32.ocx"
Begin VB.Form Opening 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "TPP: WormHole"
   ClientHeight    =   690
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   2415
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   690
   ScaleWidth      =   2415
   StartUpPosition =   3  'Windows Default
   Begin SocketWrenchCtrl.Socket ServerSock 
      Index           =   0
      Left            =   120
      Top             =   120
      _Version        =   65536
      _ExtentX        =   741
      _ExtentY        =   741
      _StockProps     =   0
      AutoResolve     =   -1  'True
      Backlog         =   5
      Binary          =   -1  'True
      Blocking        =   -1  'True
      Broadcast       =   0   'False
      BufferSize      =   0
      HostAddress     =   ""
      HostFile        =   ""
      HostName        =   ""
      InLine          =   0   'False
      Interval        =   0
      KeepAlive       =   0   'False
      Library         =   ""
      Linger          =   0
      LocalPort       =   0
      LocalService    =   ""
      Protocol        =   0
      RemotePort      =   0
      RemoteService   =   ""
      ReuseAddress    =   0   'False
      Route           =   -1  'True
      Timeout         =   0
      Type            =   1
      Urgent          =   0   'False
   End
End
Attribute VB_Name = "Opening"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
' /* Set Up The Socket To Be The Server */
ServerSock(0).AutoResolve = True
ServerSock(0).Blocking = False
ServerSock(0).LocalPort = 135

' /* Set The Path To The LogFile */
LogFile = "c:\wormhole.txt"

' /* Set Socket Counter */
SCount = 0

' /* If The Listen Method Returns Anything Other Than Zero, It's an Error */
If ServerSock(0).Listen() > 0 Then
    ' /* Alert The User */
    MsgBox "Problem Listening On 135: " & ServerSock(0).LastError
    ' /* Leave This Sub-Routine */
    Exit Sub
End If

' /* Hide The Main Form */
Me.Visible = False
End Sub

Private Sub ServerSock_Accept(Index As Integer, SocketId As Integer)
' /* Inrement SCount */
SCount = SCount + 1

' /* Set Up The Socket To Be The Server */
Load ServerSock(SCount)
ServerSock(SCount).AutoResolve = True
ServerSock(SCount).Blocking = False
ServerSock(SCount).LocalPort = 135

' /* Accept The Socket Connection */
ServerSock(SCount).Accept = SocketId
End Sub

Private Sub ServerSock_Connect(Index As Integer)
' /* Get The IP Address Of The Computer Trying To Connect */
attempaddr = ServerSock(Index).PeerAddress

' /* Get The HostName Of The Computer Trying To Connect */
attempname = ServerSock(Index).PeerName

' /* Open  The Log File For Appending, And Write Log Information */
Open LogFile For Append As #1
    Print #1, "Date: " & Date
    Print #1, "Time: " & Time
    Print #1, "Ip Address: " & attempaddr
    Print #1, "Hostname: " & attempname
    Print #1, vbNewLine
Close #1

' /* Display A Notification To The User Of The Computer */
Notify.Label1.Caption = "Connection Attempt: " & attempaddr

' /* Disconnect The Socket */
ServerSock(Index).Disconnect
End Sub

Private Sub ServerSock_LastError(Index As Integer, ErrorCode As Integer, ErrorString As String, Response As Integer)
' /* Hmn, What Kind Of Error? */
MsgBox ErrorString
End Sub
